{% extends 'PHPDishWebBundle::layout.html.twig' %}

{% block title %} PHPDish 社区{% endblock %}

{% block script %}
    <script type="text/javascript" src="{{ asset('build/js/topic.js') }}"></script>
{% endblock %}

{% block content %}
    <div class="container" role="main">
        <div class="row">
            <div class="col-md-9">
                <div class="panel panel-u">
                    <ul class="list-unstyled list-inline tab-nav" data-pjax-container="list-container">
                        {% set tab = app.request.query.get('tab') %}
                        <li {% if not tab%}class="active"{% endif %}><a href="{{ path('homepage') }}">全部</a></li>
                        <li {% if tab == 'following' %}class="active"{% endif %}><a href="{{ path('homepage', {'tab': 'following'}) }}">我关注的</a></li>
                        <li {% if tab == 'recommend' %}class="active"{% endif %}><a href="{{ path('homepage', {'tab': 'recommend'}) }}">推荐</a></li>
                    </ul>
                    <div id="list-container">
                        <div class="panel-body topic-list">
                            {% include 'PHPDishWebBundle:Topic:topic_list.html.twig' %}
                        </div>
                        {% if topics.haveToPaginate %}
                            <div class="panel-footer">
                                {% from 'PHPDishWebBundle:Macros:paginator.html.twig' import paginator %}
                                {{ paginator(topics) }}
                            </div>
                        {% endif %}
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                {% include 'PHPDishWebBundle:User:user_plate.html.twig' %}
                {{ render(controller('PHPDishWebBundle:Song:getSong')) }}
                {{ render(controller('PHPDishForumBundle:Topic:todayHotTopics', {'limit': 8})) }}
                {{ render(controller('PHPDishForumBundle:Thread:hotThreads')) }}
                {{ render(controller('PHPDishUserBundle:User:latestUsers', {'limit': 6})) }}
                {% include 'PHPDishWebBundle:Common:friend_community.html.twig' %}
            </div>
        </div>
    </div>
{% endblock %}